package com.yyk.yykywd.mvvm

import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
//import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProviders
import com.yyk.yykywd.R
//import com.yyk.yykywd.databinding.ActivityDemoBinding

class DemoActivity : AppCompatActivity() {

    companion object {
        const val TAG = "DemoActivity"
    }

    private lateinit var viewModel: DemoViewModel
//    private lateinit var binding: ActivityDemoBinding


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_demo)
        // Inflate view and obtain an instance of the binding class
//        binding = DataBindingUtil.setContentView(this,R.layout.activity_demo)

        Log.i("DemoActivity", "Called ViewModelProviders.of")
        viewModel = ViewModelProviders.of(this).get(DemoViewModel::class.java)
        // Set the viewmodel for databinding - this allows the bound layout access
        // to all the data in the ViewModel
//        binding.demoViewModel = viewModel
        // Specify the current activity as the lifecycle owner of the binding.
        // This is used so that the binding can observe LiveData updates
//        binding.lifecycleOwner = this
    }
}
